import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '@/pages/HomePage.vue'
import DoubaoPage from '@/pages/DoubaoPage.vue'
import KimiPage from '@/pages/KimiPage.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: HomePage,
    meta: {
      title: '需求表单'
    }
  },
  {
    path: '/doubao',
    name: 'Doubao',
    component: DoubaoPage,
    meta: {
      title: '方案生成'
    }
  },
  {
    path: '/kimi',
    name: 'Kimi',
    component: KimiPage,
    meta: {
      title: 'PPT生成'
    }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

// 路由守卫
router.beforeEach((to, from, next) => {
  // 设置页面标题
  if (to.meta.title) {
    document.title = `${to.meta.title} - 营销方案生成系统`
  }
  
  next()
})

export default router